home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / System 7.0 Samples / DTS.Utilities / Utilities.p < prev    next >
Encoding:
Text File  |  1994-11-18  |  22.1 KB  |  499 lines  |  [TEXT/MPS ]

  1.  
  2.  
  3. {-------------------------------------------------------------------------------------------
  4. #
  5. #    Apple Macintosh Developer Technical Support
  6. #
  7. #    Collection of Utilities for DTS Sample code
  8. #
  9. #    Program:    Utilities.p.o
  10. #    File:        Utilities.p -    Pascal Interface
  11. #
  12. #    Copyright © 1988-1990 Apple Computer, Inc.
  13. #    All rights reserved.
  14. #
  15. -------------------------------------------------------------------------------------------}
  16. {[j=20/53/1$] Pasmat Options}
  17.  
  18. UNIT Utilities;
  19.  
  20.     INTERFACE
  21.  
  22.         USES
  23.             { Type 1 }
  24.             Types, QuickDraw,
  25.  
  26.             { Type 2 }
  27.             Controls, Events, FixMath, Fonts, Memory, Menus, OSUtils, Resources, SegLoad,
  28.             TextEdit, ToolUtils, Traps, LowMem, GestaltEqu, Folders,
  29.  
  30.             { Type 3 }
  31.             Devices, Files, Script, Windows,
  32.  
  33.             { Type 4 }
  34.             Dialogs,
  35.  
  36.             { Type 5 }
  37.             Packages;
  38.  
  39.         CONST
  40.             kUseCreatorString    = - 1;                { Pass this to StandardAbout if you would
  41.                                                      like the string stored in your creator
  42.                                                      resource to appear in the about box. }
  43.             kUseRealAppName     = - 2;                { Pass this to StandardAbout if you would
  44.                                                      like the name of your application to
  45.                                                      appear in the about box. }
  46.  
  47.             rUtilErrorAlert     = 256;                { dlg ID used in ErrorAlert }
  48.             rUtilErrorMessageAlert = 257;            { dlg ID used in ErrorAlertMessage }
  49.             rStdAboutAlert         = 258;                { dlg ID used for About box. }
  50.  
  51.             rUtilStrings        = 256;                { STR# resource we use for errors. }
  52.             eStandardErr        = 1;                { Generic "An error occured" string. }
  53.             eNoMenuBar            = 2;                { "No 'MBAR' resource was found." }
  54.  
  55.             kButtonFrameSize    = 3;                { button frame’s pen size }
  56.             kButtonFrameInset    = - 4;                { inset rectangle adjustment around
  57.                                                      button }
  58.             kOSEvent            = app4Evt;            { event used by MultiFinder }
  59.             kSuspendResumeMessage = 1;                { high byte of suspend/resume event
  60.                                                      message }
  61.             kResumeMask         = 1;                { bit of message field for resume vs.
  62.                                                      suspend }
  63.             kMouseMovedMessage    = $FA;                { high byte of mouse-moved event message }
  64.             kNoEvents            = 0;                { no events mask }
  65.  
  66.             kExtremeNeg         = - 32768;            { kExtremeNeg and kExtremePos are used to
  67.                                                      set up wide open rectangles and
  68.                                                      regions. }
  69.             kExtremePos         = 32767 - 1;        { required for old region bug }
  70.  
  71.             kOffscreenLoc        = $4000;
  72.  
  73.             kDITop                = $0050;            { kDITop and kDILeft are used to locate
  74.                                                      the Disk Initialization dialogs. }
  75.             kDILeft             = $0070;
  76.  
  77.             kControlInvisible    = 0;
  78.             kControlVisible     = $FF;                {kControlInvisible is used to 'turn off'
  79.                                                      controls (i.e., cause the control not to be
  80.                                                      redrawn as a result of some Control Manager
  81.                                                      call such as SetControlValue) by being put into
  82.                                                      the contrlVis field of the record.
  83.                                                      kControlVisible is used the same way to 'turn
  84.                                                      on' the control.}
  85.  
  86.             kCntlActivate        = 0;                { enabled control’s hilite state }
  87.             kCntlDeactivate     = $FF;                { disabled control’s hilite state }
  88.             kCntlOn             = 1;                { control’s value when truned on }
  89.             kCntlOff            = 0;                { control’s value when truned off }
  90.             kSelect             = 1;                { select the control }
  91.             kDeselect            = 0;                { deselect the control }
  92.  
  93.             kScrollbarWidth     = 16;                { kScrollBarWidth can be used in
  94.                                                      calculating values for control
  95.                                                      positioning and sizing.}
  96.             kScrollbarAdjust    = kScrollbarWidth - 1;
  97.  
  98.             kDelayTime            = 8;                { For the delay time when flashing the
  99.                                                      menubar and highlighting a button.
  100.                                                      8/60ths of a second}
  101.  
  102.             kStartPtH            = 2;                { offset from the left of the screen }
  103.             kStartPtV            = 2;                { offset from the top of the screen }
  104.             kStaggerH            = 16;                { staggering amounts for new windows }
  105.             kStaggerV            = 22;
  106.  
  107.             chBackspace         = CHR(8);            { ASCII code for Backspace character }
  108.             chClear             = CHR(27);            { ASCII code for Clear key (aka ESC) }
  109.             chDown                = CHR(31);            { ASCII code for down arrow }
  110.             chEnd                = CHR(4);            { ASCII code for the End key }
  111.             chEnter             = CHR(3);            { ASCII code for Enter character }
  112.             chEscape            = CHR(27);            { ASCII code for Escape (aka Clear) key }
  113.             chFunction            = CHR(16);            { ASCII code for any function key }
  114.             chFwdDelete         = CHR($7F);         { ASCII code for forward delete }
  115.             chHelp                = CHR(5);            { ASCII code for Help key }
  116.             chHome                = CHR(1);            { ASCII code for the Home key }
  117.             chLeft                = CHR(28);            { ASCII code for left arrow }
  118.             chPageDown            = CHR(12);            { ASCII code for Page Down key }
  119.             chPageUp            = CHR(11);            { ASCII code for Page Up key }
  120.             chReturn            = CHR(13);            { ASCII code for Return character }
  121.             chRight             = CHR(29);            { ASCII code for right arrow }
  122.             chSpace             = CHR(32);            { ASCII code for Space character }
  123.             chTab                = CHR(9);            { ASCII code for Tab character }
  124.             chUp                = CHR(30);            { ASCII code for up arrow }
  125.             
  126.             { Define these for gQDVersion }
  127.             kQDOriginal            = 0;                { Original QuickDraw }
  128.             kQD8Bit                = 1;                { 8-bit Color QuickDraw }
  129.             kQD32Bit            = 2;                { 32-bit QuickDraw }
  130.  
  131.         TYPE
  132.  
  133.         { Various handy types for type coercion. For instance, you can take a handle,
  134.           cast it into a RectHandle, dereference it twice, and get a Rect. I.e.,
  135.  
  136.             myRect := RectHandle(someHandle)^^;
  137.  
  138.           Of course, this assumes that you know there is a valid rectangle at that
  139.           location in the block of data referenced by the handle. }
  140.  
  141.             IntegerHandle        = ^IntegerPtr;
  142.  
  143.             LongIntHandle        = ^LongIntPtr;
  144.  
  145.             BooleanPtr            = ^BOOLEAN;
  146.             BooleanHandle        = ^BooleanPtr;
  147.  
  148.             SignedBytePtr        = ^SignedByte;
  149.             SignedByteHandle    = ^SignedBytePtr;
  150.  
  151.             RectHandle            = ^RectPtr;
  152.  
  153.             WindowPeekPtr        = ^WindowPeek;
  154.  
  155.             { This is the template to the WIND resource. }
  156.  
  157.             WindowTemplate        = RECORD            {template to a WIND resource}
  158.                 boundsRect:         Rect;
  159.                 procID:             INTEGER;
  160.                 visible:            BOOLEAN;
  161.                 filler1:            BOOLEAN;
  162.                 goAwayFlag:         BOOLEAN;
  163.                 filler2:            BOOLEAN;
  164.                 refCon:             LONGINT;
  165.                 title:                Str255;
  166.                 END;
  167.             WindowTPtr            = ^WindowTemplate;
  168.             WindowTHndl         = ^WindowTPtr;
  169.  
  170.             TwoIntsMakesALong    = RECORD            {build a signed LONGINT...}
  171.                 CASE INTEGER OF                     {...from an unsigned INTEGER}
  172.                     1:
  173.                         (long:                 LONGINT);
  174.                     2:
  175.                         (ints:                 ARRAY [0..1] OF INTEGER);
  176.                 END;                                {TwoIntsMakesALong}
  177.  
  178.         VAR
  179.  
  180.         { The following global variables are initialized by StardardInitialization to
  181.             define the environnment.  This used to be a single SysEnvRec, but now,
  182.             all those variables defined in a SysEnvRec can be returned by Gestalt
  183.             (except sysVRefNum; see FindSysFolder).  Note that all the variables
  184.             below will be correctly initialized whether Gestalt is available or not;
  185.             the Gestalt glue handles this. }
  186.  
  187.             gMachineType:        INTEGER;            {which machine this is}
  188.             gSystemVersion:        INTEGER;            {System version number}
  189.             gProcessorType:        INTEGER;            {which CPU this is}
  190.             gHasFPU:            BOOLEAN;            {true if machine has an FPU}
  191.             gQDVersion:            INTEGER;            {major QD version #; 0 for original, 
  192.                                                         1 for color QD, 2 for 32-bit QD}
  193.             gKeyboardType:        INTEGER;            {which type of keyboard is present}
  194.             gAppleTalkVersion:    INTEGER;            {AppleTalk version number}
  195.         
  196.         { These are also handled by Gestalt. gHasPMMU has no corresponding SysEnvRec
  197.             field, but it is handled by the glue, so we include it here for completeness.
  198.             gAUXVersion will be initialized with Gestalt if present, but correctly
  199.             set even if Gestalt is not available}
  200.             gHasPMMU:            BOOLEAN;            {true if machine has a PMMU or equivalent}
  201.             gAUXVersion:        INTEGER;            {major A/UX version number (0 if not present)}
  202.  
  203.         { gHasWaitNextEvent is set to TRUE if the Macintosh we are running on has
  204.           WaitNextEvent implemented. We can use this in our main event loop to
  205.           determine whether to call WaitNextEvent or GetNextEvent. }
  206.  
  207.             gHasWaitNextEvent:    BOOLEAN;            {set up by StandardInitialization}
  208.  
  209.         { gAppResRef is the application’s resource file reference. I need to save
  210.           this since I can open other resource files. The current resource file is
  211.           always gAppResRef unless I momentarily set it to another file to read its
  212.           resources, and then immediately restore it back.}
  213.  
  214.             gAppResRef:         INTEGER;            {set up by StandardInitialization}
  215.  
  216.         { gInBackground is maintained by our osEvent handling routines. Any part of
  217.           the program can check it to find out if it is currently in the background.}
  218.  
  219.             gInBackground:        BOOLEAN;            {maintained by StandardInitialization and
  220.                                                      DoEvent}
  221.  
  222.         { gAppName holds the name of the application that's running. You can use if
  223.           for any purpose you'd like. It is also used by StandardAbout if it can't
  224.           find a string to use for the application name in a resource, so make sure
  225.           you call InitForStandardAbout if you are going to call StandardAbout. If you
  226.           call StandardInitialization, this is done for you. }
  227.  
  228.             gAppName:            Str255;
  229.  
  230.         { gSignature holds the creator signature for the running application. It follows the
  231.           same rules as those for gAppName. }
  232.  
  233.             gSignature:            OSType;
  234.  
  235.         { Initial values of these global variables are set to zero or FALSE by MPW's 
  236.           runtime initialization routines.  If the Utilities initialization routines
  237.           have been properly called, then gUtilitiesInited will be true.  If it is
  238.           not true, then the values of the above global variables are invalid. }
  239.  
  240.             gUtilitiesInited:    BOOLEAN;
  241.  
  242.         FUNCTION CenteredAlert(alertID: INTEGER; relatedWindow:WindowPtr): INTEGER;
  243.         { Given an Alert ID and a related window pointer, this routine will center
  244.           the alert on the same device as the related window.  If the related
  245.           window pointer is nil, then the alert will be centered on the device
  246.           that the alert would normally be placed if Alert was called directly. }
  247.  
  248.         PROCEDURE CenterRectInRect(outerRect: Rect; VAR innerRect: Rect);
  249.         { Given two rectangles, this routine centers the second one within the first. }
  250.  
  251.         FUNCTION CenterWindow(window:WindowPtr; relatedWindow:WindowPtr): Rect;
  252.         { Given a window pointer and a related window pointer, this routine will
  253.           center the window on the same device as the related window.  If the
  254.           related window pointer is nil, then the window will be centered on the
  255.           device that the window already is.
  256.           WARNING: This routine may move or purge memory. }
  257.  
  258.         PROCEDURE CloseAnyWindow(window: WindowPtr);
  259.         { Closes the indicated window.  Does the right thing, taking into account
  260.           that the window may belong to a DA.
  261.           WARNING: An application window is closed via a CloseWindow call.  Use
  262.                        this call when you want to keep the storage for the window
  263.                     record.  (Compare against DisposeAnyWindow.) }
  264.  
  265.         PROCEDURE DisposeAnyWindow(window: WindowPtr);
  266.         { Closes the indicated window.  Does the right thing, taking into account
  267.           that the window may belong to a DA.
  268.           WARNING: An application window is closed via a DisposeWindow call.  Use
  269.                        this call when you want to free up the storage for the window
  270.                     record.  (Compare against CloseAnyWindow.) }
  271.  
  272.         PROCEDURE DeathAlert(errResID: INTEGER; errStringIndex: INTEGER);
  273.         { Display an alert that tells the user an error occurred, then exit the
  274.           program. This routine is used as an ultimate bail-out for serious errors
  275.           that prohibit the continuation of the application. } 
  276.  
  277.         PROCEDURE DeathAlertMessage(errResID, errStringIndex, message: INTEGER);
  278.  
  279.         PROCEDURE ErrorAlert(errResID, errStringIndex: INTEGER);
  280.  
  281.         PROCEDURE ErrorAlertMessage(errResID, errStringIndex, message: INTEGER);
  282.  
  283.         FUNCTION FindSysFolder (VAR foundVRefNum: INTEGER; VAR foundDirID: LongInt): OSErr;
  284.         { FindSysFolder returns the (real) vRefNum, and the DirID of the current
  285.           system folder.  It uses the Folder Manager if present, otherwise 
  286.           it falls back to SysEnvirons.  It returns zero on success, otherwise 
  287.           a standard system error.}
  288.  
  289.         FUNCTION GetAppIndResource(theType: ResType;index: INTEGER; VAR err:OSErr): Handle;
  290.         { GetAppIndResource gets a resource from the application's resource file by index }
  291.         
  292.         FUNCTION GetAppNamedResource(theType: ResType;name: Str255; VAR err:OSErr): Handle;
  293.         { GetAppNamedResource gets a resource from the application's resource file by name }
  294.         
  295.         FUNCTION GetAppResource(theType:ResType; theID:INTEGER; VAR err:OSErr): Handle;
  296.         { GetAppResource gets a resource from the application's resource file by resource ID }
  297.         
  298.         FUNCTION GetAUXVersion: INTEGER;
  299.  
  300.         FUNCTION    GetCenteredDialog(id:INTEGER; storage: Ptr; 
  301.             relWindow, behind:WindowPtr): DialogPtr;
  302.         { Given a dialog ID and a related window pointer, this routine will center
  303.           the dialog on the same device as the related window.  If the related
  304.           window pointer is nil, then the dialog will be centered on the device
  305.           that the dialog would normally be placed if GetNewDialog was called. }
  306.  
  307.         FUNCTION    GetCenteredWindow(id:INTEGER; storage: Ptr; relWindow, behind: WindowPtr;
  308.             inColor:BOOLEAN): WindowPtr;
  309.         { Given a window ID and a related window pointer, this routine will center
  310.           the window on the same device as the related window.  If the related
  311.           window pointer is nil, then the window will be centered on the device
  312.           that the window would normally be placed if GetNewWindow was called. }
  313.  
  314.         FUNCTION GetCheckOrRadio(dlgPtr: DialogPtr; itemNo: integer): BOOLEAN;
  315.  
  316.         FUNCTION GetGestaltResult (gestaltSelector: OSType): LongInt;
  317.         { GetGestaltResult returns the result value from Gestalt for the specified selector.
  318.             If Gestalt returned an error GetGestaltResult returns zero.  Use of this function
  319.             is only cool if we don't care whether Gestalt returned an error.  In many cases
  320.             you may need to know the exact Gestalt error code so then this routine would be
  321.             inappropriate.}
  322.         
  323.         FUNCTION GetGlobalMouse: Point;
  324.         { Returns the location of the mouse in local coordinates. It does this by
  325.           calling OSEventAvail. }
  326.  
  327.         FUNCTION GetGlobalTopLeft(window: WindowPtr): Point;
  328.         { Given a window, this will return the top left point of the window’s port in
  329.           global coordinates. Something this doesn’t include, is the window’s drag
  330.           region (or title bar). This returns the top left point of the window’s
  331.           content area only. }
  332.  
  333.         FUNCTION GetKFreeSpace(vRefNum: INTEGER): LONGINT;
  334.  
  335.         FUNCTION GetMainScreenRect: Rect;
  336.  
  337.         FUNCTION GetRectDevice(globalRect: Rect): GDHandle;
  338.         { Find the greatest overlap device for the given global rectangle. }
  339.  
  340.         FUNCTION GetRectDeviceRect(globalRect: Rect): Rect;
  341.         { Find the rect of the greatest overlap device for the given global rect. }
  342.  
  343.         FUNCTION    GetSomeKindOfWindow(FUNCTION whatKind(window, relWindow:WindowPtr):Rect; 
  344.             windID:INTEGER; storage: Ptr; relWindow, behind:WindowPtr; inColor:BOOLEAN):WindowPtr;
  345.         { Given a window positioning procedure pointer, a window ID and a window
  346.           pointer the window relates to, this function open a new window by either
  347.           a NewCWindow or a NewWindow call, depending on the value of inColor.  The
  348.           window will be opened invisible, independent of what the resource says.
  349.           Once the window is opened successfully, the positioning procedure is
  350.           called.  The positioning procedure is passed a pointer to the just-opened
  351.           invisible window and a pointer to the related window.  It is up to the
  352.           positioning procedure to move the invisible window to the correct location
  353.           on the correct device.  Once the positioning procedure returns, the window
  354.           will be made visible if so indicated by the resource. }
  355.  
  356.         FUNCTION    GetStaggeredWindow(id:INTEGER; storage: Ptr; 
  357.             relWindow,behind:WindowPtr; inColor:BOOLEAN):WindowPtr;
  358.         { Given a window ID and a window pointer the window relates to, this function
  359.           will stagger the window’s rectangle before showing it on the proper screen.
  360.           This follows the Apple Human Interface Guidelines for where to place a
  361.           staggered window on the screen.  If the window is not closely associated
  362.           with another window, pass a nil for the window pointer of the related
  363.           window.  If you pass a nil, the window is simply displayed where the
  364.           resource would indicate. }
  365.  
  366.         FUNCTION GetTrapType(theTrap: INTEGER): TrapType;
  367.         { Returns the type (OSType or ToolType) of the trap. It does this by checking
  368.           the bits of the trap word. }
  369.  
  370.         FUNCTION GetWindowContentRect(window:WindowPtr):Rect;
  371.         { Given a window pointer, return the global rectangle that encloses the
  372.           content area of the window. }
  373.  
  374.         FUNCTION GetWindowCount(includeDAs,includeInvisibles:BOOLEAN):INTEGER;
  375.         { This procedure counts the number of windows in the application plane.  You
  376.           have the choices of also including DAs and invisible windows in this count. }
  377.  
  378.         FUNCTION GetWindowDevice(window:WindowPtr):GDHandle;
  379.         { Find the greatest overlap device for the given window. }
  380.  
  381.         FUNCTION GetWindowDeviceRect(window:WindowPtr):Rect;
  382.         { Given a window pointer, find the device that contains most of the window
  383.           and return the device's bounding rectangle. }
  384.  
  385.         FUNCTION GetWindowDeviceRectNMB(window:WindowPtr):Rect;
  386.         { Given a window pointer, find the device that contains most of the window
  387.           and return the device's bounding rectangle.  If this device is the main
  388.           device, then remove the menubar area from the rectangle. }
  389.  
  390.         FUNCTION GetWindowStructureRect(window:WindowPtr):Rect;
  391.         { This procedure is used to get the rectangle that surrounds the entire
  392.           structure of a window.  This is true whether or not the window is visible.
  393.           If the window is visible, then it is a simple matter of using the bounding
  394.           rectangle of the structure region.  If the window is invisible, then the
  395.           strucRgn is not correct.  To make it correct, then window has to be moved
  396.           way off the screen and then made visible.  This generates a valid strucRgn,
  397.           although it is valid for the position that is way off the screen.  It still
  398.           needs to be offset back into the original position.  Once the bounding
  399.           rectangle for the strucRgn is obtained, the window can then be hidden again
  400.           and moved back to its correct location.  Note that ShowHide is used,
  401.           instead of ShowWindow and HideWindow.  HideWindow can change the plane of
  402.           the window.  Also, ShowHide does not affect the hiliting of windows. }
  403.   
  404.         PROCEDURE GlobalToLocalRect(VAR aRect: Rect);
  405.  
  406.         PROCEDURE InitToolBox;
  407.  
  408.         PROCEDURE InitUtilities;
  409.         { This sets up some global variables for use by the utilities package.  If you call
  410.            StandardInitialization, you don't need to call this, as it will do it for you. } 
  411.  
  412.         FUNCTION IsAppWindow(window: WindowPtr): BOOLEAN;
  413.         { Returns TRUE if the windowKind of the window is greater than or equal to
  414.           userKind. If it is less, or the window is NIL, then return FALSE. }
  415.  
  416.         FUNCTION IsDAWindow(window: WindowPtr): BOOLEAN;
  417.         { Returns TRUE if the windowKind of the window is less than zero. If not, or
  418.           the window is NIL, then return FALSE. }
  419.  
  420.         PROCEDURE LocalToGlobalRect(VAR aRect: Rect);
  421.  
  422.         FUNCTION LockHandleHigh(theHandle: UNIV Handle): SignedByte;
  423.         { Does a MoveHHi on the handle and then locks it.  Also, the original state
  424.           of the handle is returned, so you can keep it and set the handle back to it's
  425.           original state with a HSetState call. }
  426.  
  427.         FUNCTION NumToolboxTraps: INTEGER;
  428.         { Determines the size of the Tool trap table. It does this by sampling a
  429.           couple of trap locations and seeing which, if any are Unimplemented. }
  430.  
  431.         PROCEDURE OutlineControl(button: UNIV ControlHandle);
  432.         
  433.         PROCEDURE OutlineDialogItem(dlgPtr: DialogPtr; item: integer);
  434.  
  435.         PROCEDURE PositionRectInRect(outerRect: Rect; VAR innerRect: Rect; horzRatio,vertRatio: Fixed);
  436.         {  Given two rectangles, this routine positions the second within the first one
  437.            so that the it maintains the spacing specified the the horzRatio and vertRatio
  438.            parameters. In other words, to center an inner rectangle hoizontally, but
  439.            have its center be 1/3 from the top of the outer rectangle, call this
  440.            routine with horzRatio = FixRatio (1, 2), vertRatio = FixRatio (1, 3). }
  441.  
  442.         PROCEDURE PullApplicationToFront;
  443.  
  444.         PROCEDURE SelectButton(button: UNIV ControlHandle);
  445.         {  Given the button control handle, this will cause the button to look as if it
  446.            has been clicked in. This is nice to do for the user if they type return or
  447.            enter to select the default item. }
  448.  
  449.         PROCEDURE SetCheckOrRadioButton(dlgPtr: DialogPtr; itemNo: INTEGER; state: INTEGER);
  450.  
  451.         FUNCTION StaggerWindow(window,relatedWindow:WindowPtr):Rect;
  452.         { This algorithm for staggering windows does quite a good job.  It also is
  453.           quite gnarly.  Here's the deal:
  454.           There are pre-designated positions that we will try when positioning a
  455.           window.  These slots will be tried from the upper-left corner towards the
  456.           lower-right corner.  If there are other windows in that slot, then we will
  457.           consider that slot taken, and proceed to the next slot.  A slot is
  458.           determined to be taken by checking a point with a slop area.  This slop
  459.           area is diamond-shaped, not simply rectangular.  If there is no other
  460.           visible window with an upper-left corner within the slopt diamond, then
  461.           we are allowed to position our window there.
  462.           The above rule holds true unless this forces the window to be partly
  463.           off the screen.  If the window ends up partly off the screen, then we give
  464.           up and just put it in the first slot. }
  465.  
  466.         PROCEDURE StandardAbout(appNameStringID: INTEGER);
  467.         { Shows a standard about box with the name of the application, its version
  468.           number, a copyright notice, and DTS credits. Most of this information is
  469.           taking from a standard DITL and the application’s 'vers' resource. The name
  470.           of the application is taken either from the 'STR ' resource passed in to
  471.           this routine, or from GetAppParms if that resource doesn’t exist, or you
  472.           pass in -1. }
  473.  
  474.         PROCEDURE StandardInitialization(callsToMoreMasters: INTEGER);
  475.         { Initializes “gInBackGround” to FALSE. Makes the following InitXXX calls:
  476.           InitGraf, InitFonts, InitWindows, InitMenus, TEInit, InitDialogs,
  477.           InitCursor. Brings application to front with 3 EventAvail calls. 
  478.           Initializes some variables using Gestalt. Calls TrapExists to initialize
  479.           “gHasWaitNextEvent”. }
  480.  
  481.         PROCEDURE StandardMenuSetup(MBARID, AppleMenuID: INTEGER);
  482.         { Installs and draws the menus indicated by 'MBAR'(MBARID). Adds DA’s to the
  483.           menu indicated by AppleMenuID by calling AppendResMenu. If the menuBar cannot
  484.           be created, the alert specified by rDeathAlert is displayed. }
  485.  
  486.         PROCEDURE ToggleCheck(dlgPtr: DialogPtr; chkItem: integer);
  487.  
  488.         FUNCTION TrapExists(theTrap: INTEGER): BOOLEAN;
  489.         { Returns TRUE if the trap exists (i.e., it’s callable without getting DS
  490.           error 12) }
  491.  
  492.         PROCEDURE ZoomToWindowDevice(window:WindowPtr; maxWidth,maxHeight,zoomDir:INTEGER; front:BOOLEAN);
  493.  
  494.     IMPLEMENTATION
  495.  
  496. {$I Utilities.inc1.p}
  497.  
  498. END.
  499.